<template>
	<view class="login">
		<view class="title">带上薯片</view>
		<view class="loginBox">
			<uni-section class="buttonColor">
				<uni-easyinput prefixIcon="auth" class="uni-mt-5" trim="all" v-model="phone" placeholder="请输入手机号"></uni-easyinput>
			</uni-section>

			<uni-section class="buttonColor">
				<uni-easyinput prefixIcon="locked" type="password" v-model="password" placeholder="请输入密码"></uni-easyinput>
			</uni-section>
			<button class="loginButton" @click="register()">注 册</button>
		</view>
	</view>
</template>

<script setup>
import { request } from '@/api/request'
import { ref } from 'vue';
const phone = ref('')
const password = ref('')

const register = async() => {
	const operation = {
		method: 'POST',
		url: `/main/account/create/${phone.value}/${password.value}`,
		data: 'GET',
		tokenRequired: false // 新增，表示是否需要token
	}
	const res = await request(operation)
	console.log(res.success)
	if(res.success==true){
		uni.redirectTo({
		url:'/pages/login/loginView/login'
	})
	}
}

</script>

<style lang="scss">
.login {
	display: flex; 
	flex-direction: column;
	align-items: center;
	height: 100vh;
	overflow: hidden;
	.loginBox {
		width: 550rpx;
		background-color: rgba(0, 0, 0, 0);

		.buttonColor {
			background-color: rgba(0, 0, 0, 0);
		}
	}
	.title{
		margin-top: 300rpx;
		margin-bottom: 50rpx;
		font-size: 50rpx; 
	}
	.handle{
		margin-top: 10rpx;
		display: flex;
		justify-content: space-between;
	}
}
.loginButton {
	top: 50rpx;
	width: 400rpx;
	height: 65rpx;
	background-color: aqua;
	text-align: center;
	line-height: 65rpx;
	font-size: 25rpx;
}
</style>